﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Threading;

namespace CMTVision.MultiLanguage
{
	public partial class Default : System.Web.UI.Page
	{
		protected void Page_Load(object sender, EventArgs e)
		{
            if (!IsPostBack)
            { 
                //Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US");
            }
		}

        protected void ChangeLanButton_Click(object sender, EventArgs e)
        {
            var cookie = Request.Cookies["language"];
            if (cookie == null)
            {
                cookie = new HttpCookie("language", "zh-cn");
                Response.Cookies.Add(cookie);
            }
            cookie.Expires = DateTime.Now.AddDays(1);
            cookie.Value = "zh-cn";
            Response.Redirect(Request.Url.ToString());
            //Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture("zh-cn");
            //Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-cn");
        }
	}
}